// Cell.cpp: implementation of the FCCell class.
//
//////////////////////////////////////////////////////////////////////

#include "stdlib.h"
#include "time.h"
#include "FCFarmari/Cell.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

FCCell::FCCell()
{
	srand((unsigned int)time(NULL));
	Weights = NULL;
	WeightsDelta = NULL;
	for(int i = 0; i < MAX_PULL; ++i)
	{
		Net[i] = 0;
		fNet[i] = 0;
	}
	Signal = 0;
}

FCCell::FCCell(const FCCell & cell)
{
	Weights = new double[cell.WeightsNum];
	Layer = cell.Layer;
	WeightsDelta = new double[cell.WeightsNum]; 
	WeightsNum = cell.WeightsNum;

	for(int i = 0; i < cell.WeightsNum; ++i)
	{
		Weights[i] = cell.Weights[i];
	}
	
}

FCCell::~FCCell()
{
	delete [] Weights;
	delete [] WeightsDelta;
}

void FCCell::InitWeights()
{
	for(int i = 0; i < WeightsNum; ++i)
	{
			Weights[i] = (rand()/(double)RAND_MAX)*2 - 1;
			WeightsDelta[i] = 0.0;
	}
			
}
